﻿@model IEnumerable<VehicleManagement.Models.Accident>
@{
    ViewBag.Title = "Index";
}

@*<h2>Index</h2>*@

<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("CarNumber") != "" && !$.query.get("CarNumber")) {
            $("input[name='CarNumber']").val($.query.get("CarNumber"));
        }

        if ($.query.get("DriverName") != "" && !$.query.get("DriverName")) {
            $("input[name='DriverName']").val($.query.get("DriverName"));
        }

        if ($.query.get("Accident") != "" && !$.query.get("Accident")) {
            $("input[name='Accident']").val($.query.get("Accident"));
        }

        $.get("/Accident/GetPagingInfo",
            {
                CarNumber: $("input[name='CarNumber']").val(),
                DriverName: $("input[name='DriverName']").val(),
                Accident: $("input[name='Accident']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
</script>
<div class="mas">
    <div class="toptitle">
        司机负责人管理平台
    </div>
    @*<div class="car"></div>*@
    @Html.Partial("_PartviewDriverManager")
    <div class="rightshow">
        <div class="classifyinfo">
            <div class="system-location">
                <a>司机负责人管理系统</a>>><a>车辆事故</a>
            </div>
            <div class="system-Userinfo">
                <span class="space">当前用户:</span><a>张测试</a><span class="space">部门:</span><a>技术部</a><a
                    class="space">退出</a>
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="apply_content">
            <div class="contrlcar">
            </div>
            <div class="createrecord">
                <div class="createrecord_bc">
                    <div class="createrecord_bc1">@Html.ActionLink("添加新记录", "Create")</div>
                </div>
            </div>
            @using (Html.BeginForm("Index", "Accident", FormMethod.Get,new { id = "SearchForm"}))
            {
             @Html.Hidden("Page");
             <div class="apply_cn1">
                <div class="apply_cn1-item">
                    记录筛选：
                </div>
                <div class="apply_cn1-item1">
                    @*<select id="sort-bar-itemSelect1" name="车辆类型">
                        <option>客车</option>
                        <option>货车</option>
                        <option>轿车</option>
                    </select>*@
                    <input type="text" name="CarNumber" value="车牌号" />
                </div>
                <div class="apply_cn1-item1">
                  @*<select id="sort-bar-itemSelect2">
                        <option>发生日期</option>
                    </select>*@
                    <input type="text" name="DriverName" value="司机姓名" />
                </div>
                <div class="apply_cn1-item1">
                      @*<select id="sort-bar-itemSelect3">
                        <option>车辆编码</option>
                        <option>已审批</option>
                    </select>*@
                    <input type="text" name="Accident" value="事故" />
                </div>
                 <div class="apply_cn1-item2">
                    <input id="Text3" name="key" type="text" value="模糊查找" class="apply_cn1-item2_itp1" />
                    <input id="SubmitSearch"
                        type="submit" value="" class="apply_cn1-item2_btn1" />
                        @*<input type="submit" value="Search" class="apply_cn1-item2_btn1"/>*@
                </div>
                <div class="clear"></div>
                
            </div>	
        }
        </div>
        <table id="applytable" cellspacing="0">
            <tr>
                <th>
                    车辆序号
                </th>
                <th>
                    司机序号
                </th>
                <th>
                    日期
                </th>
                <th>
                    花费
                </th>
                <th>
                    事故地点
                </th>
                <th>
                    编辑
                </th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                            <td>
                @Html.DisplayFor(modelItem => item.CarNumber)
                </td>
                <td>
                @Html.DisplayFor(modelItem => item.DriverName)
                </td>
                    <td>
                         @String.Format("{0:yyyy.MM.dd}", item.Date)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Cost)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Location)
                    </td>
                    <td id="myapplytabletd">
                        <div class="myapplytable_dt">
                            @Html.ActionLink("修改", "Edit", new { id = item.AccidentID })
                        </div>
                        <div class="myapplytable_dt">
                            @Html.ActionLink("详细", "Details", new { id = item.AccidentID })
                        </div>
                        <div class="myapplytable_dt">
                            @*@Html.ActionLink("删除", "Delete", new { id=item.AccidentID })*@ 
                             <a class="RemoveLink" href="javascript:void(0)" onclick="DeleteAccident(@item.AccidentID)">删除</a>
                        </div>
                    </td>
                </tr>
            }
        </table>
        <div>
            共<span id="TotalItems"></span>条记录，
            每页显示<span id="ItemsPerPage"></span>条，
            共<span id="TotalPages"></span>页，
            当前第<span id="CurrentPage"></span>页
            <a id="FirstPage" href="javascript:void(0)">首页</a>
            <a id="PrevPage" href="javascript:void(0)">上一页</a>
            <a id="NextPage" href="javascript:void(0)">下一页</a>
            <a id="LastPage" href="javascript:void(0)">末页</a>
            <span>跳转到</span>
            <input type="text" id="PageToGo" />
            <input type="button" id="GoToPage" value="Go" />
        </div>
    </div>
    <div class="clear">
    </div>
</div>
